#pragma GCC optimize(2, "Ofast", "inline")
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <algorithm>
#define endl '\n'
#define int long long
#define pii pair<int, int>
#define fi first
#define se second
#define int128 __int128_t
using namespace std;

// 已知
int n, q, x, a[555555];

// 未知
int cnt = 0;


signed main()
{
    cin.tie(0)->ios::sync_with_stdio(false);
    cin >> n >> q;
    for (int i = 1;i <= q;++i)
    {
        cin >> x;
        if (a[x] == 0)
        {
            if (x == 1 and a[x + 1] == 0) cnt++;
            else if (x == n and a[x - 1] == 0) cnt++;
            else if (a[x - 1] == 0 and a[x + 1] == 0) cnt++;
            else if (a[x - 1] == 1 and a[x + 1] == 1) cnt--;
        }
        else
        {
            if (x == 1 and a[x + 1] == 0) cnt--;
            else if (x == n and a[x - 1] == 0) cnt--;
            else if (a[x - 1] == 0 and a[x + 1] == 0) cnt--;
            else if (a[x - 1] == 1 and a[x + 1] == 1) cnt++;
        }
        a[x] = 1 - a[x];
        cout << cnt << endl;
    }

    return 0;
}